package com.itheima.search.controller.v1;

import com.itheima.model.common.dtos.ResponseResult;
import com.itheima.model.search.dtos.BookSearchDto;
import com.itheima.search.service.BookSearchService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1")
@Api(value = "图书搜索相关的接口",tags = "图书搜索相关的接口")
public class BookSearchController {
    @Autowired
    private BookSearchService bookSearchService;

    /**
     * 搜索图书
     * @param dto
     * @return
     */
    @PostMapping
    @ApiOperation("搜索图书")
    public ResponseResult search(@RequestBody BookSearchDto dto){
        return bookSearchService.search(dto);
    }
}
